/*
 * eventhandler.cpp
 *
 *  Created on: 26 May 2012
 *      Author: hframe
 */

#include "input_handler.h"
#include "input_handler_dpad.h"
#include "input_handler_mouse.h"
#include "input_handler_keyboard.h"
#include "input_handler_touchpad.h"
#include "input_handler_trackball.h"
#include "input_handler_touchscreen.h"

startnamespace(androidplus)
startnamespace(input)

input_handler::input_handler() {


}

input_handler::~input_handler() {

}

 void input_handler::handle(const AInputEvent *event){
     switch(AInputEvent_getSource(event)){
     case AINPUT_SOURCE_TOUCHSCREEN:
    	 handle_touchscreen_event(event);
    	 break;
     case AINPUT_SOURCE_TRACKBALL:
    	 handle_trackball_event(event);
    	 break;
     case AINPUT_SOURCE_TOUCHPAD:
    	 handle_touchpad_event(event);
    	 break;
     case AINPUT_SOURCE_DPAD:
    	 handle_dpad_event(event);
    	 break;
     case AINPUT_SOURCE_KEYBOARD:
    	 handle_keyboard_event(event);
     break;
     case AINPUT_SOURCE_MOUSE:
    	 handle_mouse_event(event);
    	 break;

     }
}



 	void  input_handler::handle_touchscreen_event(const AInputEvent *event ){
 		input_handler_touchscreen().handle(event);
 	}
 		void input_handler:: handle_keyboard_event(const AInputEvent *event ){
 			input_handler_keyboard().handle(event);
 		}
 		void  input_handler::handle_trackball_event(const AInputEvent *event ){
input_handler_trackball().handle(event);
 		}
 		void  input_handler::handle_mouse_event(const AInputEvent *event ){
 			input_handler_mouse().handle(event);

 		}
 		void  input_handler::handle_dpad_event(const AInputEvent *event ){
 			input_handler_dpad().handle(event);

 		}
 		void input_handler::handle_touchpad_event(const AInputEvent *event){
input_handler_touchpad().handle(event);
 		}

endnamespace(input)
endnamespace(androidplus)
